package com.dapp;

import com.contracts.DogCoin;
import com.service.DappService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.methods.response.Web3ClientVersion;
import org.web3j.protocol.http.HttpService;

import java.io.File;

import static org.web3j.tx.Contract.GAS_LIMIT;
import static org.web3j.tx.ManagedTransaction.GAS_PRICE;

@SpringBootApplication
public class Web3jdemoApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(Web3jdemoApplication.class, args);
    }

    @Override
    public void run(String... strings) throws Exception {
        DogCoin dogCoin = DogCoin.deploy(DappService.web3j,
                DappService.loadCredentials(new File("G:\\sw\\Geth\\data\\remote\\keystore\\UTC--2018-03-29T03-26-37.696212700Z--1f2021ca6514483ce285b17e911b8dd0f4bca211"), "123456789"),
                GAS_PRICE, GAS_LIMIT
                ).send();
    }
}
